##今天遇到的問題
AI 改完之後,原本版本在哪裡?資料夾改名成 final、final2、final真的最後版,能暫時保存,但很難看出每次到底改了什麼。
Git 用 commit 記錄版本;diff 顯示差異。Git 不等於 GitHub,也不會自動把本機內容上傳。今天只在本機留紀錄。
Claude Code prompt:
在工作台建立或補充 .gitignore,保留既有規則。
排除 .venv/、.local/、__pycache__/、.env 與 .env.*;
保留 .env.example;私人 notes/ 與產出 reports/ 暫時排除。
不要執行 commit、push 或修改相鄰的引擎。
解釋每個排除項目。
自己在 PowerShell 執行:
git init
git status --short
git add .gitignore hello.py project-goal.md docs
git diff --cached --name-only
git diff --cached
git commit -m "docs: record the first research goal"
若 Git 尚未設定身分,依提示設定這個 repository 的 user.name 和 user.email;公開作者 email 可使用自行取得的 GitHub noreply 位址,不把教材占位字串當真實身分。
再改 hello.py 的一行字,執行 git diff。確定這次只想丟掉該檔未提交的練習修改後,才使用 git restore -- hello.py;這會捨棄該檔未提交內容。Git 官方入門
直接 git add .,把 .env 一起 staged。先停止 commit,檢查 ignore 規則和 staged 檔名;不要靠發表前記得刪除來保護憑證。
實測後補:自己的 commit ID、一次 diff 和實際恢復結果;避免顯示私人 email。
明天建立 CLAUDE.md,讓專案規則跟著檔案一起保存。